<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>短链接生成器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 30vh;
            background-color: #f4f4f4;
        }
        .container {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        input[type="text"] {
            width: 300px;
            padding: 10px;
            margin-right: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        button {
            padding: 10px 20px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
        .result {
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>短链接生成器</h2>
        <input type="text" id="longUrl" placeholder="输入长链接">
        <button onclick="generateShortLink()">生成短链接</button>
        <div class="result" id="result"></div>
    </div>

    <script>
        function generateShortLink() {
            const longUrl = document.getElementById('longUrl').value;
            if (!longUrl) {
                alert('请输入长链接');
                return;
            }
            // 模拟生成短链接
            const shortUrl = 'http://short./' + btoa(longUrl).slice(0, 8);
            document.getElementById('result').innerHTML = `短链接: <a href="${shortUrl}" target="_blank">${shortUrl}</a>`;
        }
    </script>
</body>
</html>